/*
 * @Author: zqx me_zqx@163.com
 * @Date: 2025-05-26 15:43:42
 * @LastEditors: zqx me_zqx@163.com
 * @LastEditTime: 2025-07-14 16:05:13
 * @FilePath: /XMate-h5/src/views/minutes/composables/useMinutes.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { useRoute } from "vue-router";

export function useMinutes() {
  const route = useRoute();
  // 检查纪要链接是否正确
  function checkMinutesUrl() {
    const { confId, shareId } = route.params;
    if (!confId && !shareId) {
      return "参数为空";
    }
    if (confId.length > 0 && confId.length !== 19) {
      return "参数长度异常";
    }
    return "";
  }

  function pushToPcWeb() {
    const { confId, shareId } = route.params;
    let host = import.meta.env.VITE_XMATE_BASE_URL;
    let webUrl = "";
    if (shareId) {
      webUrl = `${host}/#/postmeet/share/${shareId}`;
    } else {
      webUrl = `${host}/#/postmeet/record/${confId}`;
    }
    window.location.href = webUrl;
  }

  return {
    checkMinutesUrl,
    pushToPcWeb
  };
}
